<!DOCTYPE html>
<html lang="zh-cmn-Hans">

	<head>
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-control" content="no-cache" />
		<meta http-equiv="Cache" content="no-cache" />
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
		<title>QC首检</title>
		<link rel="stylesheet" href="../layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../jexcel-master/dist/css/jquery.jexcel.css" />
	</head>

	<body>
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>QC首检程序</b></big></legend>
			<div class="layui-fluid layui-form layui-form-pane">
				<div class="layui-form-item">
					<div class="layui-row">
						<label class="layui-form-label">显示工序:</label>
						<input type="radio" name="gx[]" value="固晶" title="固晶" lay-filter="gx[]">
						<input type="radio" name="gx[]" value="焊线" title="焊线" lay-filter="gx[]">
						<input type="radio" name="gx[]" value="点胶" title="点胶" lay-filter="gx[]">
						<input type="radio" name="gx[]" value="切割" title="切割" lay-filter="gx[]">
						<input type="radio" name="gx[]" value="分光" title="分光" lay-filter="gx[]">
						<input type="radio" name="gx[]" value="编带" title="编带" lay-filter="gx[]">
					</div>
					<label class="layui-form-label">登录账号:</label>
					<div class="layui-input-block">
						<input class="layui-input" placeholder="请输入EM+工号（例如:EM00000），按下回车登录。" id="qr" type="text" />
					</div>
					<div class="layui-row">
						<label class="layui-form-label">检规:</label>
						<div class="layui-input-block">
							<input type="checkbox" name="Fruit[]" title="固晶" lay-skin="primary" lay-filter="primaryTest[]" value="固晶">
							<input type="checkbox" name="Fruit[]" title="焊线" lay-skin="primary" lay-filter="primaryTest[]" value="焊线">
							<input type="checkbox" name="Fruit[]" title="点胶" lay-skin="primary" lay-filter="primaryTest[]" value="点胶">
							<input type="checkbox" name="Fruit[]" title="切割" lay-skin="primary" lay-filter="primaryTest[]" value="切割">
							<input type="checkbox" name="Fruit[]" title="分光" lay-skin="primary" lay-filter="primaryTest[]" value="分光">
							<input type="checkbox" name="Fruit[]" title="编带" lay-skin="primary" lay-filter="primaryTest[]" value="编带">
						</div>
					</div>
					<div class="layui-row">
						<label class="layui-form-label">轮询时间(s):</label>
						<div class="layui-input-block">
							<input class="layui-input" placeholder="设置轮询的时间,单位:秒(修改后立即生效)" id="LXSJ" type="text" />
						</div>
					</div>
				</div>
			</div>
		</fieldset>
		<fieldset class="layui-elem-field site-demo-button">
			<legend><big><b>这里是当前信息组合</b></big></legend>
			<div id="DQ" class="layui-fluid layui-form layui-form-pane">
				<div class="layui-row">
					<div class="layui-col-sm6">
						<label class="layui-form-label">员工工号:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="这里是员工工号(请扫入工号)" id="YGGH" type="text" />
						</div>
					</div>
					<div class="layui-col-sm6">
						<label class="layui-form-label">员工姓名:</label>
						<div class="layui-input-block">
							<input class="layui-input" readonly=true placeholder="这里是员工姓名(根据工号自动产生)" id="YGXM" type="text" />
						</div>
					</div>
				</div>
				<!-- 这里是JExcel的表格位置 -->
				<div id="mytable"></div>
				<div id="jyxm"></div>
				<div class="layui-row">
					<label class="layui-form-label">判定结果:</label>
					<input type="radio" name="jyjg" value="OK" title="OK判定通过" lay-filter="jyjg">
					<input type="radio" name="jyjg" value="NG" title="NG检验不通过" lay-filter="jyjg">
				</div>
				<div class="layui-row">
					<div class="layui-form-item layui-form-text layui-col-sm12">
						<label class="layui-form-label ">整单备注:</label>
						<div class="layui-input-block">
							<textarea placeholder="请填写备注" class="layui-textarea" id="BZSTR"></textarea>
						</div>
					</div>
				</div>
			</div>
			<div class="layui-row layui-btn-container">
				<div class="layui-col-sm4">
					<button class="layui-btn  layui-btn-normal" id="keep">保存</button>
				</div>
			</div>
		</fieldset>
		<fieldset class="layui-elem-field site-demo-button layui-btn-container">
			<legend><big><b>产线送检列表</b></big></legend>
			<div class="layui-fluid layui-form layui-form-pane">
				<div id="YC" class="layui-row"></div>
			</div>
		</fieldset>
		<!-- 加载jQuery文件 -->
		<script src="../js/jquery.min.js"></script>
		<!-- 加载类ui文件 -->
		<script src="../layui/layui.js"></script>
		<!-- 加载JExcel文件 -->
		<script src="../jexcel-master/dist/js/jquery.jexcel.js"></script>
		<!-- 写脚本 -->
		<script>
			var i = 0; //循环
			var d = new Date(); //日期的毫秒计算
			var hm = d.getTime(); //得到毫秒
			var set = null; //全局变量,设定轮询
			var html = ""; //画btn组
			var Hhtml = ""; //画窗口的画面,把程序写到Layer里面
			var Dhtml = ""; //画窗口的画面,把程序写到Layer里面
			var ZiDian1 = {} //字典1
			var ZiDian2 = {} //字典2
			var data2 = {} //JExcel数据
			//var JYSJ = "";//检验时机代码,全局变量,用于发后台存储
			var JYJG = ""; //检验结果,全局变量,用于发后台存储
			var SJDM = ""; //送检代码,全局变量,用于发后台存储
			var xmlb; //把layer弹窗暴露在全局
			var HH = [] //HH作为全局传递Hdata的数组
			var DD = [] //DD作为全局传递Ddata的数组
			var ky = 0; //存Key,用来传值给delbtn
			var ycidd = []; //存异常ID的key值列表,然后用来find
			var XM = ""; //姓名暴露给全局,然后可以同步ajax得出值
			var JT = ""; //取机台号
			var JT3 = {} //字典3,取机台
			var msgstr = {} //信息json对象
			var DuXie = [{
				type: 'text',
				readOnly: true
			}, {
				type: 'text',
				readOnly: true
			}, {
				type: 'number',
				wordWrap: true
			}, {
				type: 'text',
				readOnly: true
			}];
			var LieMing = [
				'送检代码', '送检信息', '抽检数量(K)', '不良率'
			];
			var LieKuan = [
				80, 650, 150, 100
			];
			var DuXie1 = [{
				type: 'text',
				readOnly: true
			}, {
				type: 'text',
				readOnly: true
			}, {
				type: 'text',
				readOnly: true
			}, {
				type: 'text',
				readOnly: true
			}, {
				type: 'number',
				wordWrap: true
			}, {
				type: 'text',
				readOnly: true
			}];
			var LieMing1 = [
				'检验ID', '检验代码', '检验项目', 'AQL', '不良数量(K)', '不良率'
			];
			var LieKuan1 = [
				80, 100, 400, 150, 150, 100
			];
			$(document).ready(function() {
				//这里是画面准备完毕后执行的程式
				layui.use(['layer', 'form', 'element', 'table'], function() { //载入layui模块:layer弹出层,form表单,element元素组件做分页或其他
					//layer.msg('初始化正常!');
					var layer = layui.layer,
						form = layui.form,
						element = layui.element,
						table = layui.table;

					if(localStorage.lxsj) {
						$("#LXSJ").val(localStorage.lxsj);
						set = setInterval(fn, (localStorage.lxsj * 1000)); //设置轮询
					} else {
						localStorage.lxsj = 20;
						$("#LXSJ").val(localStorage.lxsj);
						set = setInterval(fn, (localStorage.lxsj * 1000)); //设置轮询
					}

					if(localStorage.yggh) { //如果HTML5WEB存储存在,就查询,否则就弹窗提示
						$("#YGGH").val(localStorage.yggh);
						var sss = getxm(localStorage.yggh);
						$("#YGXM").val(sss);
						layer.msg(sss + '，欢迎回来!');
						localStorage.ygxm = sss;
					} else {
						layer.msg("请先登录");
					}

					if(localStorage.jygx) {
						fn();
					} else {
						layer.msg("请选择工序");
					}

					//监听指定复选框
					form.on('checkbox(primaryTest[])', function(data) {
						var bm_num;
						var names = document.getElementsByName("Fruit[]");
						for(var k = 0; k < names.length; k++) {
							if(names[k].checked) {
								if(bm_num) {
									bm_num += "," + names[k].value;
								} else {
									bm_num = names[k].value;
								}
							}
						}
						localStorage.gx = bm_num;
						console.log(localStorage.gx);
					});

					//监听指定单选框
					form.on('radio(gx[])', function(data) {
						//console.log(data.elem);// 得到radio原始DOM对象
						console.log(data.value); // 被点击的radio的value值
						localStorage.jygx = data.value;
						location.reload(); //变更了工序后就刷新整个画面
					});

					//监听指定单选框
					form.on('radio(jyjg)', function(data) {
						//console.log(data.elem); //得到radio原始DOM对象
						console.log(data.value); //被点击的radio的value值
						JYJG = data.value;
					});
				});
				$("#qr").select(); //画面准备完毕后就选择扫码输入框

				var bm_num;
				var gx = {}
				var str = localStorage.gx;
				var n;
				if(str) {
					n = str.split(",");
				}

				for(var k in n) {
					gx[n[k]] = n[k];
				}

				var names = document.getElementsByName("Fruit[]");
				for(var k in names) {
					if(gx[names[k].value]) {
						names[k].checked = true;
						//console.log(names[k].checked);
					}
				}

				names = document.getElementsByName("gx[]");
				for(var k in names) {
					if(names[k].value == localStorage.jygx) {
						names[k].checked = true;
						//console.log(names[k].checked);
					}
				}

				$('#mytable').jexcel({
					allowDeleteColumn: false, //不允许删除行
					rowDrag: false, //不允许拖动
					allowManualInsertRow: false, //禁止用户插入一个新列(只能存在1笔)
					allowManualInsertColumn: false, //不允许新增列
					columnSorting: false, //不允许排序
					columns: DuXie,
					colHeaders: LieMing,
					colWidths: LieKuan
				});

				$('#jyxm').jexcel({
					onafterchange: BLLv,
					allowDeleteColumn: false, //不允许删除行
					rowDrag: false, //不允许拖动
					allowManualInsertRow: false, //禁止用户插入一个新列(只能程序增加)
					allowManualInsertColumn: false, //不允许新增列
					columnSorting: false, //不允许排序
					columns: DuXie1,
					colHeaders: LieMing1,
					colWidths: LieKuan1
				});
			});

			$("#qr").click(function() { //这里是扫描输入框的回车按下后执行的程式
				$("#qr").select();
			});

			$("#qr").keypress(function(e) {
				if(e.keyCode === 13) { //如果按下的键值是回车键13就执行以下语句
					$("#qr").select(); //扫描输入框选择
					var QRC = $("#qr").val(); //定义局部变量QRC=扫描输入框的值
					if(/^EM\d{5}$/.test(QRC)) {
						localStorage.yggh = QRC;
						location.reload(); //如果是工号,还要清除字典内容,重新来过...所以干脆刷新一下好了,下面是语句
					} else {
						layer.msg('请输入员工工号');
					}
				}
			});

			Date.prototype.format = function(fmt) { //这里是日期格式化公式
				var o = {
					"M+": this.getMonth() + 1, //月份
					"d+": this.getDate(), //日
					"h+": this.getHours(), //小时
					"m+": this.getMinutes(), //分
					"s+": this.getSeconds(), //秒
					"q+": Math.floor((this.getMonth() + 3) / 3), //季度
					"S": this.getMilliseconds() //毫秒
				};
				if(/(y+)/.test(fmt)) {
					fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				}
				for(var k in o) {
					if(new RegExp("(" + k + ")").test(fmt)) {
						fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
					}
				}
				return fmt;
			}

			function fn() { //轮询的内容
				d = new Date();
				//layer.msg('现在已经轮询了'+ (i+=1) + '次了,距上次轮询时间为:' + (d.getTime() - hm) + '毫秒');
				hm = d.getTime();
				$.ajax({
					url: "http://172.31.3.27:84/index.php?s=/scancode/shou_jian", //172.31.3.27:84//127.0.0.1:85
					data: "gxx=" + localStorage.jygx,
					dataType: "JSON",
					success: function(sss) {
						ycidd = []; //先重置
						for(var k in sss['SJ']) {
							var yc = sss['SJ'][k]['YiChang'];
							var gh = sss['SJ'][k]['YGGH'];
							var jt = sss['SJ'][k]['YiChangJiTai'];
							var gd = sss['SJ'][k]['GongDanHao'];
							var cl = sss['SJ'][k]['ChuLiGH'];
							var d = sss['SJ'][k]['YCID'];
							var tm = sss['SJ'][k]['YiChangStartTime'];
							var xm = sss['SJ'][k]['YGXM'];
							var wxcc = sss['SJ'][k]['wxcc'];
							var clxm = sss['SJ'][k]['ChuLiXM'];
							console.log(wxcc);
							ycidd.push(d);
							if(ZiDian1[d]) {
								ZiDian1[d] = d + '丨' + yc + '丨产品系列：' + wxcc  + '丨机台：' + jt + '丨送检人：' + gh + '丨' + xm + '丨工单：' + gd + '丨处理人：' + cl + '丨' + clxm+'丨送检时间：' + tm;
								$("#" + d).html(ZiDian1[d]);
								$("#" + d).attr("data-d", d); //更改数据d的内容
							} else {
								ZiDian1[d] = d + '丨' + yc + '丨产品系列：' + wxcc +'丨机台：' + jt + '丨送检人：' + gh + '丨' + xm + '丨工单：' + gd + '丨处理人：' + cl + '丨' + clxm+ '丨送检时间：' + tm;
								html = "<button id='" + d + "' class='layui-col-sm7 layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal' data-d='" + d + "' onclick='showDetails(this)'>" + ZiDian1[d] + "</button>";
								$("#YC").append(html);
							}
							JT3[d] = jt; //字典3=机台号

							if(cl == localStorage.yggh) {
								$("#" + d).attr("disabled", false); //开始时间按钮被禁用
								$("#" + d).attr("class", 'layui-btn layui-btn-fluid layui-btn-xs layui-btn-warm'); //添加禁用渲染
							} else if(cl && cl !== localStorage.yggh) {
								$("#" + d).attr("disabled", true); //开始时间按钮被禁用
								$("#" + d).attr("class", 'layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal layui-btn-disabled'); //添加禁用渲染
							} else if(d != SJDM) {
								//console.log(d+'准备被解锁'+SJDM);
								$("#" + d).attr("disabled", false); //按钮启用
								$("#" + d).attr("class", 'layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal'); //添加渲染
							}
						}

						for(var ky in ZiDian1) {
							//console.log(ycidd);
							//console.log(ZiDian1[ky]);
							//console.log(ycidd.includes(ky*1));
							if(ycidd.includes(ky * 1)) { //判断sss结果集里面是不是不包含字典里面的数据

							} else {
								console.log(ky * 1);
								$("#" + ky).remove();
								delete ZiDian1[ky];
								delete JT3[ky];
							}
						}
					}
				});
			}

			$("#LXSJ").change(function() {
				localStorage.lxsj = $("#LXSJ").val();
				//console.log(localStorage.lxsj);
				clearInterval(set);
				set = setInterval(fn, (localStorage.lxsj * 1000)); //设置轮询
			});

			function showDetails(data) {
				if(xmlb) {
					layer.close(xmlb); //关闭指定的窗口
				}
				ZiDian2 = {}
				Dhtml = "";
				var d1 = data.getAttribute("data-d");
				SJDM = d1;
				data.disabled = true; //按钮禁用
				data.className = 'layui-col-sm7 layui-btn layui-btn-fluid layui-btn-xs layui-btn-normal layui-btn-disabled'; //添加禁用渲染
				//console.log(d1);
				layer.msg("数据更新中,请稍后!");
				$.ajax({
					url: "http://172.31.3.27:84/index.php?s=/scancode/shou_jian/shoujian", //172.31.3.27:84//127.0.0.1:85
					data: "qrc=" + localStorage.yggh + "&idd=" + d1 + "&gxx=" + localStorage.gx,
					dataType: "JSON",
					success: function(sss) {
						if(sss['msg']) {
							layer.msg(sss['msg']);
						}

						fn();

						for(var k in sss['JY']) {
							var xmdm = sss['JY'][k]['JYXMDM'];
							var zb = sss['JY'][k]['GongXu'];
							var jyxm = sss['JY'][k]['JYMXSM'];
							var jybz = sss['JY'][k]['JYBZ'];
							var jyfs = sss['JY'][k]['JYFS'];
							var jylb = sss['JY'][k]['JYLBMC'];
							var jysz = sss['JY'][k]['JYSZ'];
							var aql = sss['JY'][k]['AQL'];
							var d = sss['JY'][k]['ID'];
							//ZiDian2[d] = xmdm+'丨项目：'+jyxm+'丨标准：'+jybz+'丨方式：'+jyfs+'丨类别：'+jylb+'丨水准：'+jysz+'丨AQL：'+aql;
							//layerhtml += "<button id='"+d+"' class='layui-btn layui-btn-normal' data-d='"+d+"' onclick='showJY(this)'>"+ZiDian2[d]+"</button>";
							ZiDian2[d] = [xmdm, jyxm, jybz, jyfs, jylb, jysz, aql];
							Dhtml += "" +
								"<tr id='" + d + "'>" +
								"<td>" + "<button id='" + d + "' class='layui-btn layui-btn-xs layui-btn-normal' data-d='" + d + "' onclick='showJY(this)'>" + xmdm + "</button></td>" +
								"<td>" + jyxm + "</td>" +
								"<td>" + zb + "</td>" +
								"<td>" + jybz + "</td>" +
								"<td>" + jyfs + "</td>" +
								"<td>" + jylb + "</td>" +
								"<td>" + jysz + "</td>" +
								"<td>" + aql + "</td>" +
								"</tr>";
						}

						Hhtml = "" +
							"<table lay-even class='layui-table' lay-size='sm'>" +
							"<thead>" +
							"<th lay-data='{field:'xmdm', width:100}' >代码</th>" +
							"<th lay-data='{field:'xmdm', width:100}' >项目</th>" +
							"<th lay-data='{field:'jyxm', width:100}' >工序</th>" +
							"<th lay-data='{field:'jybz', width:100}' >标准</th>" +
							"<th lay-data='{field:'jyfs', width:100}' >方式</th>" +
							"<th lay-data='{field:'jylb', width:100}' >类别</th>" +
							"<th lay-data='{field:'jysz', width:100}' >水准</th>" +
							"<th lay-data='{field:'aql', width:100}' >AQL</th>" +
							"</thead>" +
							"<tbody>";

						xmlb = layer.open({
							title: '检验项目列表(根据各工序和工单的检验群组码列出项目)',
							maxmin: true,
							cancel: function(index, layero) {
								if(confirm('确定要关闭么')) { //只有当点击confirm框的确定时，该层才会关闭
									layer.close(index);
									fn();
								}
								return false;
							},
							type: 1,
							offset: 'r',
							area: '600px',
							//,content:'<div class="layui-btn-container layui-fluid">'+layerhtml+'</div>'
							content: Hhtml + Dhtml + "</tbody></table>",
							//,btn:'关闭全部'
							//,btnAlign:'c' //按钮居中
							shade: 0 //不显示遮罩
							//,yes:function(){
							//	layer.closeAll();
							//}
						});

						var data1 = [
							[d1, ZiDian1[d1], , '0.00%']
						];
						$('#mytable').jexcel('setData', data1);
						data2 = {};
						$('#jyxm').jexcel('setData', [
							[]
						]);
					}
				});
			}

			function showJY(data) {
				var d1 = data.getAttribute("data-d");
				//console.log(d1);
				data.disabled = true; //开始时间按钮被禁用
				data.className = 'layui-btn layui-btn-xs layui-btn-normal layui-btn-disabled'; //添加禁用渲染
				//layer.msg("Layer的按钮被点击!");
				data2[d1] = [d1, ZiDian2[d1][0], ZiDian2[d1][1], ZiDian2[d1][6]];
				var result = Object.keys(data2).map(function(key) {
					return [data2[key][0], data2[key][1], data2[key][2], data2[key][3]];
				});
				$('#jyxm').jexcel('setData', result);
				JT = "";
			}

			$("#keep").click(function() {
				HH = [];
				DD = [];
				//console.log($('#jyxm').jexcel('getData'));
				//console.log($('#mytable').jexcel('getData'));
				var Hdata = $('#mytable').jexcel('getData');
				var Ddata = $('#jyxm').jexcel('getData');
				if(SJDM && JYJG && Hdata[0][2]) {
					//console.log(JYJG);
					if(JYJG == 'NG' && Ddata[0][4] == '' && Ddata.length < 1) {
						layer.tips("<span style='color:red'><big><b>未保存！NG时，请确认【不良数量】和【检验项目】是否有输入。</b></big></span>", this, {
							tips: [2, '#fff']
						});
					} else if(JYJG == 'OK' && Ddata[0][0] != '') {
						layer.tips("<span style='color:red'><big><b>未保存！OK时，请不要点检验项目，或请切换/刷新单据，重新记录。</b></big></span>", this, {
							tips: [2, '#fff']
						});
					} else {
						var d = new Date;
						for(var k in Ddata) {
							DD.push({
								"BLXMID": Ddata[k][0],
								"BLQTY": Ddata[k][4]
							});
						}
						HH.push({
							'YGGH': localStorage.yggh,
							'YCID': Hdata[0][0].toString(),
							'ChouYangQTY': Hdata[0][2].toString(),
							'YiChangEndTime': d.format("yyyy-MM-dd hh:mm:ss"),
							'JG': JYJG,
							'BZ': $("#BZSTR").val()
						});
						//layer.msg('假装自己被传到后端保存了');
						console.log({
							'HH': HH,
							'DD': DD
						});
						$.ajax({
							type: 'POST',
							url: "http://172.31.3.27:84/index.php?s=/scancode/shou_jian/keep", //172.31.3.27:84//127.0.0.1:85
							data: "hdjson=" + JSON.stringify({
								'HH': HH,
								'DD': DD
							}),
							dataType: "json",
							success: function(sss) {
								console.log(sss);
								if(sss['msg']) {
									layer.msg(sss['msg']);
									if(sss['msg'] == '保存成功') {
										var Hdata = $('#mytable').jexcel('getData');
										var d1 = Hdata[0][0];
										$("#" + d1).remove();
										$('#mytable').jexcel('setData', [
											[]
										]);
										$('#jyxm').jexcel('setData', [
											[]
										]);
										$('#BZSTR').val("");
									}
								}
							}
						});

						JT = JT3[Hdata[0][0]].substr(0, 3);
						console.log(JT + "丨" + JT3[Hdata[0][0]].substr(0, 3));
						msgstr = {
							'msg': '机台号:' + JT3[Hdata[0][0]] + ' 已完成首检,首检结果:' + JYJG,
							'sss': {
								'JT': JT3[Hdata[0][0]],
								'JG': JYJG
							}
						}
						var jsonstr1 = JSON.stringify(msgstr);
						$.ajax({
							type: "publish",
							url: "http://" + document.domain + ":2121/?type=publish" + "&to=" + JT + "&content=" + jsonstr1,
							dataType: "text",
							success: function(data) {
								layer.msg('保存成功'); //返回信息);
								console.log(data);
							}
						});
					}
				} else {
					layer.tips("<span style='color:red'><big><b>未保存！请检查【送检代码】和【检验结果】是否有选择，【抽检数量】是否有填写！</b></big></span>", this, {
						tips: [2, '#fff']
					});
				}

			});

			var BLLv = function() { //自动计算不良率
				var Hdata = $('#mytable').jexcel('getData');
				var Ddata = $('#jyxm').jexcel('getData');
				if(Hdata[0][2]) {
					var sum = 0;
					for(var k in Ddata) {
						sum += Ddata[k][4] * 1;
						console.log(sum);
						Ddata[k][5] = ((Ddata[k][4] / Hdata[0][2] * 100).toFixed(2) + '%');
					}
					Hdata[0][3] = ((sum / Hdata[0][2] * 100).toFixed(2) + '%');

					$('#mytable').jexcel('setData', Hdata);
					$('#jyxm').jexcel('setData', Ddata);
					console.log(Hdata);
					console.log(Ddata);
				} else {
					layer.msg("请输入不良总数");
				}
			}

			function getxm(gh) { //得到姓名的公式
				XM = "";
				$.ajax({
					type: 'POST',
					url: "http://172.31.3.27:84/index.php?s=/scancode/shou_jian/xm", //172.31.3.27:84//172.31.3.27:84/index
					async: false,
					data: "qrc=" + gh,
					dataType: "text",
					success: function(sss) {
						console.log(sss);
						XM = sss;
					}
				});
				return XM;
			}
		</script>
	</body>

</html>